<template>
  <div>
    父组件
    <button @click="count++">count:{{ count }}</button>
    <hr />
  </div>
</template>

<script setup>
import { ref } from "vue";

const count = ref(0);
// Vue 2 does not support top level await in <script setup>.
const sleep = (time) => {
  return new Promise((res) => {
    setTimeout(() => {
      res();
    }, time);
  });
};
async function foo() {
  console.log(111);
  await sleep(2000);
  console.log(222);
}
foo();
</script>

<style scoped>
button {
  padding: 20px 20px;
  background-color: pink;
}
</style>
